1
00:00:00,430 --> 00:00:01,020
All right.

2
00:00:01,410 --> 00:00:07,230
So now that we've established that there is an inverse relationship between the precision school and

3
00:00:07,230 --> 00:00:16,470
recall we'll need a way to reconcile the two because ideally you want both high precision and high recall.

4
00:00:16,470 --> 00:00:22,350
The good news is that both of these metrics can be blended into a single value which is called the f

5
00:00:22,350 --> 00:00:25,590
score also known as the f one score.

6
00:00:26,580 --> 00:00:38,730
Here's the definition the f score is defined as two times precision times recall divided by precision

7
00:00:39,120 --> 00:00:47,590
plus recall so what this formula is telling us is that we want to create a balanced classifier.

8
00:00:47,670 --> 00:00:57,750
We try and maximize the f1 score let's head over to Jupiter notebook and calculate this I'll insert

9
00:00:57,810 --> 00:01:10,040
a quick section hitting him hold f hyphen school or F one school and here I'll calculate the value f

10
00:01:10,070 --> 00:01:10,920
1 underscore.

11
00:01:10,920 --> 00:01:21,840
Score is equal to well what do we say two times and then I'll be precision on a score score times recall

12
00:01:21,960 --> 00:01:33,240
on the score score all divided by precision on a score score plus recall underscore score and if we

13
00:01:33,240 --> 00:01:48,060
want to print this out c f score is and then curly braces colon C I don't know to dot format parentheses

14
00:01:48,570 --> 00:02:00,000
F one and a score score and before I hit shift enter I'll put a decimal point here and what we get is

15
00:02:00,390 --> 00:02:10,520
the f score is equal to zero point nine five which actually is very very good but how do we interpret

16
00:02:10,700 --> 00:02:13,840
the F school what does it mean well.

17
00:02:14,380 --> 00:02:21,280
So technically speaking the f score is the harmonic average the harmonic mean of precision and recall

18
00:02:22,180 --> 00:02:30,900
and because of this it takes both the false positives and the false negatives into account also it always

19
00:02:30,900 --> 00:02:32,480
has a value between 0 and 1.

20
00:02:32,670 --> 00:02:39,420
So 1 is the maximum value which is why zero point nine five is very very high and zero is the minimum

21
00:02:39,420 --> 00:02:48,720
value so in conclusion we've done a lot of evaluation on our need based classifier we've looked at a

22
00:02:48,720 --> 00:02:56,250
number of metrics precision recall f score and accuracy and we're doing actually very very very well

23
00:02:56,490 --> 00:03:04,020
because the number of false positives and false negatives is very low given the amount of data that

24
00:03:04,020 --> 00:03:06,090
we have now.

25
00:03:06,210 --> 00:03:09,270
Of course our spam filter isn't perfect right.

26
00:03:09,360 --> 00:03:14,910
I mean spam filters these days are actually getting really really good right because they don't just

27
00:03:15,000 --> 00:03:21,120
look at the words in the email body they actually look at a lot of other things as well write that a

28
00:03:21,120 --> 00:03:28,410
spammer might do for example a spammer might falsify the header or always send spam from like the same

29
00:03:28,410 --> 00:03:36,360
IP address which is why there are IP blacklists so truth be told I'm actually always really really impressed

30
00:03:36,390 --> 00:03:43,950
when a spammer manages to inbox in my gmail or in my hotmail account I'm almost always tempted to actually

31
00:03:43,950 --> 00:03:50,070
reply like Hey how did you manage to get around the spam filter and get into my inbox tell me your secrets

32
00:03:50,520 --> 00:03:58,470
but that's probably just going to net me a lot more spam but I think we've come very very far and you

33
00:03:58,470 --> 00:04:04,530
really deserve a big big pat on the back if you've completed all of this and made it through all of

34
00:04:04,530 --> 00:04:11,550
this and understood it this was a very very involved and a very very big project but we've touched on

35
00:04:11,760 --> 00:04:17,940
many many areas of machine learning and data science and we were able to learn a lot of these concepts

36
00:04:18,300 --> 00:04:25,200
as they came up as we needed them as part of this project so again well done and I'll see you in the

37
00:04:25,200 --> 00:04:27,870
next lesson as always take her.
